#include "event.h"
#include "msg.h"

void event_gui_send_button(event *e)
{
    char buffer[20];
    
    if(e->type != EVENT_BUTTON)
        return;
    
    cmd_get_button(e->ScreenId,e->CtrlId,buffer);
    gui_send_msg(buffer,sizeof(buffer));    
}

void event_gui_send_text(event *e)
{
    char buffer[20];
    
    if(e->type != EVENT_SET_TEXT)
        return;  
    
    cmd_set_text(e->ScreenId,e->CtrlId,e->data,buffer);
    gui_send_msg(buffer,sizeof(buffer)); 
}

event gui_get_event(void)
{
    char buffer[20];
    event e;
    
    gui_recv_msg(buffer);
    if(msg_explain(buffer,&e) == 0)
        e.type = DEFAULT_EVENT;
    
    return e;
}

// end of file -----------------------------------------------------------------

